import React, { useState } from 'react'

export default function App() {
  const [type, settype] = useState<boolean>(false)
  return (
    <div>
        <Child type={type} changeType={():void=>{
            settype(!type);
        }}></Child>
        {type? <div>这是抽屉</div>:<div>抽屉没了</div>}
    </div>
  )
}

interface fun {
    type?:boolean,
    changeType:()=>void
}

function Child(props:fun){
    let {changeType} = props;
    return (
        <div>
        <button onClick={()=>{
            changeType();
        }}>显示与否</button>
    </div>
    )
}
